<script setup lang="ts">
import { RouterLink, RouterView, useRouter } from 'vue-router'
const router = useRouter()
// import LoginView from './views/Login/LoginView.vue';

// import { useUser } from '@/stores/loginer'

// const userCount = useUser()

// const userLogin = () => {
//   userCount.islogin = false;
//   userCount.username = '';
// }
</script>

<!-- <template>
  <header>

    <div class="wrapper">

      <nav>
        <RouterLink to="/">Home</RouterLink>
        <RouterLink to="/about">About</RouterLink>
        <RouterLink to="/userInsertInfo">用户添加</RouterLink>
        <RouterLink to="/userListView">用户列表</RouterLink>
        <RouterLink to="/roleInsertInfo">角色添加</RouterLink>
        <RouterLink to="/roleListView">角色列表</RouterLink>
        <RouterLink to="/menuInsertInfo">菜单添加</RouterLink>
        <RouterLink to="/menuListView">菜单列表</RouterLink>
        <RouterLink to="/rolePressionView">权限分配</RouterLink>
        <RouterLink to="/sourceView">溯源管理</RouterLink>
      </nav>
    </div>
  </header>

  <RouterView />
</template> -->

<template>
  <div class="wrapper">
    <el-container>
      <el-header style="background-color: #538fd9;">
        <div style="width: 80vw; float: left;">
          <h2 style="margin: 10px auto;text-align: center;color: white;">
            溯源管理
          </h2>
        </div>
        <!-- <div v-show="userCount.islogin" style="margin: 15px auto;">
          <span style="font-size: 16px;color: black;">欢迎登录：<span style="color: chartreuse;">{{ userCount.username
              }}</span></span>
          <el-button type="danger" @click="userLogin">退出登录</el-button>
        </div> -->
      </el-header>
      <el-row>
        <el-col :span="3">
          <el-aside>
            <el-menu active-text-color="#ffd04b" background-color="#545c64" default-active="2" text-color="#fff"
              style="width: 200px;height: 190vmax;" router>
              <el-menu-item index="/">
                <el-icon>
                  <HomeFilled />
                </el-icon>
                <span>Home</span>
              </el-menu-item>
              <el-menu-item index="/about">
                <el-icon>
                  <HelpFilled />
                </el-icon>
                <span>About</span>
              </el-menu-item>
              <el-sub-menu index="1">
                <template #title>
                  <el-icon>
                    <User />
                  </el-icon>
                  <span>用户管理</span>
                </template>
                <el-menu-item-group>
                  <el-menu-item index="/userInsertInfo">注册</el-menu-item>
                  <el-menu-item index="/userListView">用户列表</el-menu-item>
                </el-menu-item-group>
              </el-sub-menu>
              <el-sub-menu index="2">
                <template #title>
                  <el-icon>
                    <Avatar />
                  </el-icon>
                  <span>角色管理</span>
                </template>
                <el-menu-item-group>
                  <el-menu-item index="/roleInsertInfo">角色添加</el-menu-item>
                  <el-menu-item index="/roleListView">角色列表</el-menu-item>
                </el-menu-item-group>
              </el-sub-menu>
              <el-sub-menu index="3">
                <template #title>
                  <el-icon>
                    <Goods />
                  </el-icon>
                  <span>菜单管理</span>
                </template>
                <el-menu-item-group>
                  <el-menu-item index="/menuInsertInfo">菜单添加</el-menu-item>
                  <el-menu-item index="/menuListView">菜单列表</el-menu-item>
                </el-menu-item-group>
              </el-sub-menu>
              <el-sub-menu index="4">
                <template #title>
                  <el-icon>
                    <Goods />
                  </el-icon>
                  <span>权限管理</span>
                </template>
                <el-menu-item-group>
                  <el-menu-item index="/rolePressionView">权限分配</el-menu-item>
                </el-menu-item-group>
              </el-sub-menu>
              <el-sub-menu index="5">
                <template #title>
                  <el-icon>
                    <Goods />
                  </el-icon>
                  <span>溯源管理</span>
                </template>
                <el-menu-item-group>
                  <el-menu-item index="/sourceView">溯源列表</el-menu-item>
                  <el-menu-item index="/MobileTerminalList">移动端</el-menu-item>
                </el-menu-item-group>
              </el-sub-menu>
            </el-menu>
          </el-aside>
        </el-col>
        <el-col :span="20">
          <el-main>
            <RouterView />
          </el-main>
        </el-col>
      </el-row>
      <!-- <el-row v-else>
        <div class="routerView">
          <LoginView></LoginView>
        </div>
      </el-row> -->
    </el-container>
  </div>
</template>

<style scoped>
header {
  line-height: 1.5;
  max-height: 100vh;
}

.logo {
  display: block;
  margin: 0 auto 2rem;
}

nav {
  width: 100%;
  font-size: 12px;
  text-align: center;
  margin-top: 2rem;
}

nav a.router-link-exact-active {
  color: var(--color-text);
}

nav a.router-link-exact-active:hover {
  background-color: transparent;
}

nav a {
  display: inline-block;
  padding: 0 1rem;
  border-left: 1px solid var(--color-border);
}

nav a:first-of-type {
  border: 0;
}

@media (min-width: 1024px) {
  header {
    place-items: center;
    padding-right: calc(var(--section-gap) / 2);
  }

  .logo {
    margin: 0 2rem 0 0;
  }

  header .wrapper {
    place-items: flex-start;
    flex-wrap: wrap;
  }

  nav {
    text-align: center;
    margin-left: -1rem;
    font-size: 1rem;

    padding: 1rem 0;
    margin-top: 1rem;
  }
}
</style>
